//  @ Project : GagalPanen
//  @ File Name : plantconstants.cpp
//  @ Date : 3/9/2011
//  @ Author : dolphinigle
//
//

#include <string>
#include <assert.h>

#include "plantconstants.hpp"
#include "harvesttype.hpp"

const int PlantConstants::kPlantCount = 12;

const std::string PlantConstants::kPlantNames[] = {
  "Alstruk",
  "UI",
  "IP",
  "OOP",
  "Pohon Pisang",
  "Orkom",
  "Clausal Form",
  "5 Teman",
  "IP 4",
  "Laptop",
  "100 Fruit",
  "1000 Fruit"};
const int PlantConstants::kFruitIds[] = {
  0,
  1,
  2,
  3,
  4,
  5,
  6,
  7,
  8,
  9,
  10,
  11};
const HarvestType PlantConstants::kPlantHarvestTypes[] = {
  kHarvestOnce,
  kHarvestOnce,
  kHarvestOnce,
  kHarvestOnce,
  kMultipleHarvest,
  kMultipleHarvest,
  kHarvestOnce,
  kHarvestOnce,
  kHarvestOnce,
  kHarvestOnce,
  kMultipleHarvest,
  kMultipleHarvest};
const int PlantConstants::kPlantMatureTime[] = {
  1,
  2,
  3,
  2,
  3,
  5,
  1,
  1,
  7,
  10,
  11,
  12};
const int PlantConstants::kPlantRipeTimeMultiplier[] = {
  1,
  2,
  3,
  5,
  1,
  1,
  1,
  1,
  1,
  1,
  5,
  2};
const int PlantConstants::kPlantDeadTime[] = {
  3,
  15,
  10,
  8,
  10,
  1000000000,
  5,
  1000000000,
  2,
  3,
  5,
  1};
const int PlantConstants::kPlantSeasonMask[] = {
  3,
  2,
  1,
  3,
  1,
  2,
  4,
  7,
  1,
  2,
  1,
  2};

int PlantConstants::getPlantCount() {
  return kPlantCount;
}

std::string PlantConstants::getPlantName(int plant_id) {
  assert(plant_id >= 0 && plant_id < PlantConstants::getPlantCount());
  return kPlantNames[plant_id];
}

int PlantConstants::getFruitId(int plant_id) {
  assert(plant_id >= 0 && plant_id < PlantConstants::getPlantCount());
  return kFruitIds[plant_id];
}

HarvestType PlantConstants::getPlantHarvestType(int plant_id) {
  assert(plant_id >= 0 && plant_id < PlantConstants::getPlantCount());
  return kPlantHarvestTypes[plant_id];
}

int PlantConstants::getPlantMatureTime(int plant_id) {
  assert(plant_id >= 0 && plant_id < PlantConstants::getPlantCount());
  return kPlantMatureTime[plant_id];
}

int PlantConstants::getPlantRipeTime(int plant_id, int number_of_times_harvested) {
  assert(plant_id >= 0 && plant_id < PlantConstants::getPlantCount());
  assert(number_of_times_harvested >= 0);
  return kPlantRipeTimeMultiplier[plant_id] * (number_of_times_harvested+1);
}

int PlantConstants::getPlantDeadTime(int plant_id) {
  assert(plant_id >= 0 && plant_id < PlantConstants::getPlantCount());
  return kPlantDeadTime[plant_id];
}

std::string PlantConstants::getViewSeedRep(int plant_id) {
  // MOCK
  return "SS";
}
std::string PlantConstants::getViewMatureRep(int plant_id) {
  // MOCK
  return "MM";
}
std::string PlantConstants::getViewHarvestableRep(int plant_id) {
  // MOCK
  return "HH";
}

std::string PlantConstants::getViewDeadRep(int plant_id) {
  // MOCK
  return "DD";
}

int PlantConstants::getPlantSeasonMask(int plant_id) {
  assert(plant_id >= 0 && plant_id < PlantConstants::getPlantCount());
  return kPlantSeasonMask[plant_id];
}

